<nz-breadcrumb *ngIf="childValue.length==0" class="breadcrumb-pos">
  <i nz-icon type="link" theme="outline" style="color:#1890FF;padding-right:4px"></i>
  <nz-breadcrumb-item>
    <a routerLink="/main/printer">打印机</a>
  </nz-breadcrumb-item>
  <nz-breadcrumb-item>
    签约打印机
  </nz-breadcrumb-item>
</nz-breadcrumb>
<div class="form-div">
  <form nz-form [formGroup]="validateForm" (ngSubmit)="submitForm()">
    <nz-form-item>
      <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="user">选择租户</nz-form-label>
      <nz-form-control [nzSm]="16" [nzXs]="24">
        <nz-input-group>
            <nz-select formControlName="user" style="width: 100%;" #user (ngModelChange)="getUserName(user)">
              <nz-option *ngIf="isShow" nzLabel="请先添加租户"></nz-option>
              <nz-option *ngFor="let data of userlist" nzLabel="{{data.companyName}}" nzValue="{{data.id}}"></nz-option>
            </nz-select>
        </nz-input-group>
        <nz-form-explain class="checkResult" *ngIf="validateForm.get('user').dirty && validateForm.get('user').errors">请选择租户!</nz-form-explain>
      </nz-form-control>
    </nz-form-item>

    <nz-form-item>
      <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="cashPledge">签约开始时间</nz-form-label>
        <nz-form-control [nzSm]="16" [nzXs]="24" style="text-align:left;">
          <nz-date-picker class="date-picker" formControlName="date" [nzFormat]="dateFormat"></nz-date-picker>
        <nz-form-explain class="checkResult" *ngIf="validateForm.get('cashPledge').dirty && validateForm.get('cashPledge').errors">请选择签约开始时间!</nz-form-explain>
      </nz-form-control>
    </nz-form-item>

    <nz-form-item>
      <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="payType">结算周期</nz-form-label>
      <nz-form-control [nzSm]="16" [nzXs]="24">
        <nz-input-group>
            <nz-select formControlName="payType" style="width: 100%;">
              <nz-option nzLabel="年结算" nzValue="0"></nz-option>
              <nz-option nzLabel="半年结算" nzValue="1"></nz-option>
              <nz-option nzLabel="季结算" nzValue="2"></nz-option>  
              <nz-option nzLabel="月结算" nzValue="3"></nz-option>  
            </nz-select>
        </nz-input-group>
        <nz-form-explain class="checkResult" *ngIf="validateForm.get('payType').dirty && validateForm.get('payType').errors">请选择结算周期!</nz-form-explain>
      </nz-form-control>
    </nz-form-item>

    <nz-form-item>
      <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="multiple">结算周期倍数</nz-form-label>
        <nz-form-control [nzSm]="16" [nzXs]="24">
          <nz-input-number style="width:100%;" [nzMin]="1" [nzPrecision]="0.1" formControlName="multiple" [nzPlaceHolder]="'请输入结算周期倍数/正整数'"></nz-input-number>
        <nz-form-explain class="checkResult" *ngIf="validateForm.get('multiple').dirty && validateForm.get('multiple').errors">请输入结算周期倍数!</nz-form-explain>
      </nz-form-control>
    </nz-form-item>

    <nz-form-item>
      <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>自动续约</nz-form-label>
      <nz-form-control [nzSm]="16" [nzXs]="24" style="text-align: left;left: 20px;">
        <nz-radio-group [(ngModel)]="radioValue" [ngModelOptions]="{standalone: true}">
          <label style="margin-right:20px;" nz-radio nzValue="1">是</label>
          <label nz-radio nzValue="0">否</label>
        </nz-radio-group>
        <nz-form-explain class="checkResult" *ngIf="">请选择是否自动续约!</nz-form-explain>
      </nz-form-control>
    </nz-form-item>

    <nz-form-item>
      <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="setMealMoney">套餐金额</nz-form-label>
        <nz-form-control [nzSm]="16" [nzXs]="24">
          <nz-input-number style="width:100%;" [nzMin]="0" formControlName="setMealMoney" [nzPlaceHolder]="'请输入套餐金额/元'"></nz-input-number>
        <nz-form-explain class="checkResult" *ngIf="validateForm.get('setMealMoney').dirty && validateForm.get('setMealMoney').errors">请输入套餐金额!</nz-form-explain>
      </nz-form-control>
    </nz-form-item>

    <nz-form-item>
      <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="blackPresented">黑白套餐量</nz-form-label>
        <nz-form-control [nzSm]="16" [nzXs]="24">
          <nz-input-number style="width:100%;" [nzMin]="0" [nzPrecision]="0.1" formControlName="blackPresented" [nzPlaceHolder]="'请输入黑白套餐量/张'"></nz-input-number>
        <nz-form-explain class="checkResult" *ngIf="validateForm.get('blackPresented').dirty && validateForm.get('blackPresented').errors">请输入黑白套餐量!</nz-form-explain>
      </nz-form-control>
    </nz-form-item>

    <nz-form-item>
      <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="coloursPresented">彩色套餐量</nz-form-label>
        <nz-form-control [nzSm]="16" [nzXs]="24">
          <nz-input-number style="width:100%;" [nzMin]="0" [nzPrecision]="0.1" formControlName="coloursPresented" [nzPlaceHolder]="'请输入彩色套餐量/张'"></nz-input-number>
        <nz-form-explain class="checkResult" *ngIf="validateForm.get('coloursPresented').dirty && validateForm.get('coloursPresented').errors">请输入彩色套餐量!</nz-form-explain>
      </nz-form-control>
    </nz-form-item>

    <nz-form-item>
      <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="blackUnit">黑白纸张单价</nz-form-label>
        <nz-form-control [nzSm]="16" [nzXs]="24">
          <nz-input-number style="width:100%;" [nzMin]="0" formControlName="blackUnit" [nzPlaceHolder]="'请输入黑白纸张单价/元'"></nz-input-number>
        <nz-form-explain class="checkResult" *ngIf="validateForm.get('blackUnit').dirty && validateForm.get('blackUnit').errors">请输入黑白纸张单价!</nz-form-explain>
      </nz-form-control>
    </nz-form-item>

    <nz-form-item>
      <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="coloursUnit">彩色纸张单价</nz-form-label>
        <nz-form-control [nzSm]="16" [nzXs]="24">
          <nz-input-number style="width:100%;" [nzMin]="0" formControlName="coloursUnit" [nzPlaceHolder]="'请输入彩色纸张单价/元'"></nz-input-number>
        <nz-form-explain class="checkResult" *ngIf="validateForm.get('coloursUnit').dirty && validateForm.get('coloursUnit').errors">请输入彩色纸张单价</nz-form-explain>
      </nz-form-control>
    </nz-form-item>

    <nz-form-item>
      <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="cashPledge">押金</nz-form-label>
        <nz-form-control [nzSm]="16" [nzXs]="24">
          <nz-input-number style="width:100%;" [nzMin]="0"formControlName="cashPledge" [nzPlaceHolder]="'请输入押金/元'"></nz-input-number>
        <nz-form-explain class="checkResult" *ngIf="validateForm.get('cashPledge').dirty && validateForm.get('cashPledge').errors">请输入押金!</nz-form-explain>
      </nz-form-control>
    </nz-form-item>

    <nz-form-item nz-row style="margin-bottom:8px;">
      <nz-form-control [nzSpan]="16" [nzOffset]="6" style="text-align:center;">
        <button nz-button nzType="primary" [nzLoading]="btn_loading" (click)="signPrinter()" style="margin-right:100px;">提交</button>
        <button *ngIf="childValue.length>0" nz-button nzType="primary" (click)="cancel()">取消</button>
        <button *ngIf="childValue.length==0" nz-button nzType="primary" (click)="backPrevent()" routerLink="/main/printer">返回</button>
      </nz-form-control>
    </nz-form-item>
  </form>
</div>